<%@page language="java" contentType="text/html; charset=UTF-8" isELIgnored="false" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="html" tagdir="/WEB-INF/tags" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<!DOCTYPE html>
<html>
<html:header title="日常收支打印">

    <style media="print">
        @page {
            margin: 0mm; /* this affects the margin in the printer settings */
            size: landscape;
        }
    </style>
    <script>
        function printPage(type, data){
            let $printDiv = $("#printDiv");
            $printDiv.empty();

            if (type == 1){
                genPrintDiv($printDiv, data.id, "日常收入单", data.no);
            }else {
                genPrintDiv($printDiv, data.id, "日常支出单", data.no);
            }

            let beforeList = [];
            beforeList.push({newLine:true, paddingBottom:8, label:"门店", content:data.store.name});

            let unit;
            if (data.unitType == 1) {
                unit = "无";
            } else if (data.unitType == 2) {
                unit = data.custom.name;
            } else {
                unit = data.provider.name;
            }
            if (type == 1){
                beforeList.push({newLine:true, paddingBottom:8, label:"付款单位", content:unit});
                beforeList.push({newLine:true, paddingBottom:8, label:"账目类型", content:data.budgetProject.name});
                beforeList.push({newLine:true, paddingBottom:8, label:"收入账户", content:data.settAccountVo.store.name + " > " + data.settAccountVo.name});
                beforeList.push({newLine:true, paddingBottom:8, label:"金额", content:getPrice(data.amt)});
            } else {
                beforeList.push({newLine:true, paddingBottom:8, label:"收款单位", content:unit});
                beforeList.push({newLine:true, paddingBottom:8, label:"账目类型", content:data.budgetProject.name});
                beforeList.push({newLine:true, paddingBottom:8, label:"支出账户", content:data.settAccountVo.store.name + " > " + data.settAccountVo.name});
                beforeList.push({newLine:true, paddingBottom:8, label:"金额", content:getPrice(data.amt)});
            }
            beforeList.push({newLine:true, paddingBottom:14, label:"备注", content:data.remark});
            beforeList.push({width:0,label:"经办人", content:data.user.name});
            beforeList.push({width:0,label:"业务日期", content:GMTToDate(data.date)});
            beforeList.push({width:0,label:"制单人", content:data.makeUser.name});
            beforeList.push({width:0, label:"制单时间", content:data.makeTime});

            genPrintLine($('#'+data.id+' .before'), beforeList);
            window.print();
        }
    </script>

</html:header>
<body>
<div id="printDiv"></div>
</body>
</html>